package com.zqs.bimq;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class MyMessageProducer {

    //根据配置文件中写好的配置自动生成管理mq的bean
    @Resource
    private RabbitTemplate rabbitTemplate;


    public void sendMessage(String exchange, String routingKey, String message) {
        //发送消息
        rabbitTemplate.convertAndSend(exchange, routingKey, message);
    }

}
